﻿namespace UnityDarkSkin.Lib
{
    public static class Versions
    {
        /// <summary>
        /// Contains all known byte records for patching
        /// </summary>
        static readonly Version[] versions = new Version[]
        {
            new Version(
                name: "2018.2 & older (x86)",
                lightBytes: new byte[] {0x75, 0x04, 0x33, 0xC0, 0x5E, 0xC3, 0x8B, 0x06, 0x5E, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC},
                darkBytes: new byte[] {0x74, 0x04, 0x33, 0xC0, 0x5E, 0xC3, 0x8B, 0x06, 0x5E, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC}
            ),
            new Version(
                name: "2018.2 & older (x64)",
                lightBytes: new byte[] {0x75, 0x08, 0x33, 0xC0, 0x48, 0x83, 0xC4, 0x20, 0x5B, 0xC3, 0x8B, 0x03, 0x48, 0x83, 0xC4, 0x20, 0x5B, 0xC3},
                darkBytes: new byte[] {0x74, 0x08, 0x33, 0xC0, 0x48, 0x83, 0xC4, 0x20, 0x5B, 0xC3, 0x8B, 0x03, 0x48, 0x83, 0xC4, 0x20, 0x5B, 0xC3}
            ),
            new Version(
                name: "2018.3",
                lightBytes: new byte[] {0x75, 0x08, 0x33, 0xC0, 0x48, 0x83, 0xC4, 0x30, 0x5B, 0xC3, 0x8B, 0x03, 0x48, 0x83, 0xC4, 0x30},
                darkBytes: new byte[] {0x74, 0x08, 0x33, 0xC0, 0x48, 0x83, 0xC4, 0x30, 0x5B, 0xC3, 0x8B, 0x03, 0x48, 0x83, 0xC4, 0x30}
            ),
            new Version(
                name: "2018.4",
                lightBytes: new byte[] {0x74, 0x04, 0x33, 0xC0, 0xEB, 0x02, 0x8B, 0x03, 0x48, 0x8B, 0x4C, 0x24, 0x58, 0x48},
                darkBytes: new byte[] {0x75, 0x04, 0x33, 0xC0, 0xEB, 0x02, 0x8B, 0x03, 0x48, 0x8B, 0x4C, 0x24, 0x58, 0x48}
            ),
            new Version(
                name: "2019.1",
                lightBytes: new byte[] {0x74, 0x04, 0x33, 0xC0, 0xEB, 0x02, 0x8B, 0x07},
                darkBytes: new byte[] {0x75, 0x04, 0x33, 0xC0, 0xEB, 0x02, 0x8B, 0x07}
            ),
            new Version(
                name: "2019.2",
                lightBytes: new byte[] {0x75, 0x15, 0x33, 0xC0, 0xEB, 0x13, 0x90, 0x49},
                darkBytes: new byte[] {0x74, 0x15, 0x33, 0xC0, 0xEB, 0x13, 0x90, 0x49}
            ),

            /*
            Orig:
            00007FF7188778EA  39 05 0C 1F 9A 06 7F 36 80 3D FF 1E 9A 06 00 75 
            00007FF7188778FA  15 33 C0 EB 13 90 49 FF C0 42 80 3C 03 00 0F 84  
            Mod:
            00007FF7188778EA  3B C0 90 90 90 90 7F 36 80 3D FF 1E 9A 06 00 74
            00007FF7188778FA  15 33 C0 EB 13 90 49 FF C0 42 80 3C 03 00 0F 84 
             */
            new Version(
                name: "2019.2.14",
                lightBytes: new byte[]
                {
                    0x39, 0x05, 0x0C, 0x1F, 0x9A, 0x06, 0x7F, 0x36, 0x80, 0x3D, 0xFF, 0x1E, 0x9A, 0x06, 0x00, 0x75,
                    0x15, 0x33, 0xC0, 0xEB, 0x13, 0x90, 0x49, 0xFF, 0xC0, 0x42, 0x80, 0x3C, 0x03, 0x00, 0x0F, 0x84
                },
                darkBytes: new byte[]
                {
                    0x3B, 0xC0, 0x90, 0x90, 0x90, 0x90, 0x7F, 0x36, 0x80, 0x3D, 0xFF, 0x1E, 0x9A, 0x06, 0x00, 0x74,
                    0x15, 0x33, 0xC0, 0xEB, 0x13, 0x90, 0x49, 0xFF, 0xC0, 0x42, 0x80, 0x3C, 0x03, 0x00, 0x0F, 0x84
                }
            ),

            /*
            Orig:
            00007FF6D1447FB9  75 15 33 C0 EB 13 90 49 FF C0 42 80 3C 03 00 0F  
            Mod:
            00007FF6D1447FB9  74 15 33 C0 EB 13 90 49 FF C0 42 80 3C 03 00 0F
             */
            new Version(
                name: "2019.3 / 2020.1",
                lightBytes: new byte[] { 0x75, 0x15, 0x33, 0xC0, 0xEB, 0x13, 0x90, 0x49, 0xFF, 0xC0, 0x42, 0x80, 0x3C, 0x03, 0x00, 0x0F },
                darkBytes: new byte[] { 0x74, 0x15, 0x33, 0xC0, 0xEB, 0x13, 0x90, 0x49, 0xFF, 0xC0, 0x42, 0x80, 0x3C, 0x03, 0x00, 0x0F }
            ),

            /*
            Orig:
            022B 433C: 75 14 33 C0 48 83 C4 40  5B C3 48 FF C2 41 80 3C
            Mod:
            022B 433C: 74 14 33 C0 48 83 C4 40  5B C3 48 FF C2 41 80 3C
             */
            new Version (
                name: "2020.1 (beta)",
                lightBytes: new byte[] { 0x75, 0x14, 0x33, 0xC0, 0x48, 0x83, 0xC4, 0x40, 0x5B, 0xC3, 0x48, 0xFF, 0xC2, 0x41, 0x80, 0x3C },
                darkBytes: new byte[] { 0x74, 0x14, 0x33, 0xC0, 0x48, 0x83, 0xC4, 0x40, 0x5B, 0xC3, 0x48, 0xFF, 0xC2, 0x41, 0x80, 0x3C }
            ),
        };

        public static Version[] Get()
        {
            return versions;
        }
    }
}